package com.andy.module.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter

/**
 * @creator:LuoFan
 * @date:2022/5/31
 * @description:
 */
class SimpleViewPagerAdapter(val activity: FragmentActivity, val list: MutableList<String>) : FragmentStateAdapter(activity) {

    override fun getItemCount(): Int {
        return list.size
    }

    override fun createFragment(position: Int): Fragment {
        val fragmentName = list[position]
        return activity.supportFragmentManager.fragmentFactory.instantiate(activity.classLoader, fragmentName)
    }


}